<template>
	<view class="transfer">
		<view class="transfer_centent">
			<view class="transfer_one">
				<view class="transfer_one_left">
					誉马积分：
				</view>
				<view class="transfer_one_right">
					{{userInfo.kd_score}}
				</view>
			</view>		
			<view class="transfer_one">
				<view class="transfer_one_left">
					数量
				</view>
				<view class="transfer_one_right">
					<input type="number"  v-model="params.zhuan_kd_score" placeholder="请输入">
				</view>
			</view>
			<view class="transfer_one" v-if="false">
				<view class="transfer_one_left">
					支付密码
				</view>
				<view class="transfer_one_right">
					<input type="number" placeholder="请输入">
				</view>
			</view>
		</view>
		<view class="transfer_button" @click="confirmTransfer">
			兑换
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				userInfo:"",
				params:{
					zhuan_kd_score:"",//转增余额
					mobile:"",//转增电话
					// password:"",
				},
			}
		},
		onShow() {
			this.loadData()
		},
		methods:{
			async loadData() {
				await uni.request({
					url: '/wanlshop/user/refresh',
					method: 'POST',
					success: res => {
						this.userInfo=res.data.userinfo
						// console.log(res.data.userinfo,'89999999999999999999999999999999999')
					}
				});
			},
			async confirmTransfer(){				
				if(!this.params.zhuan_kd_score)  return this.$wanlshop.msg('请输入正确的积分值')
				await uni.request({
					url: '/wanlshop/Signin/buykdj',
					method: 'POST',
					data:this.params,
					success: res => {
						this.$wanlshop.msg('兑换成功')
						this.params.mobile=''
						this.params.kdj=''
						this.loadData()
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.transfer{
		width: 100%;
		box-sizing: border-box;
		padding: 20rpx 24rpx;
		.transfer_centent{
			width: 100%;
			min-height: 100rpx;
			background-color: #ffffff;
			border-radius: 20rpx;
			box-sizing: border-box;
			padding: 0 20rpx;
			.transfer_one{
				width: 100%;
				height: 100rpx;
				border-bottom: 1rpx solid #f7f7f7;
				display: flex;
				align-items: center;
				.transfer_one_left{
					font-size: 30rpx;
					color: #333333;
					font-weight: 500;
				}
				.transfer_one_right{
					flex: 1;
					text-align: right;
					font-size: 30rpx;
					color: #333333;
					margin-left: 25rpx;
					input{
						width: 100%;
						height: 100rpx;
						font-size: 30rpx;
					}
				}
			}
		}
		.transfer_button{
			width: 500rpx;
			height: 90rpx;
			line-height: 90rpx;
			border-radius: 45rpx;
			text-align: center;
			background-color: #ff3d33;
			font-size: 30rpx;
			color: #ffffff;
			margin: 280rpx auto  0;
		}
	}
</style>